<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    {include file="common/head" /}
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <table class="layui-table" lay-even>
            <colgroup>
                <col width="150">
                <col>
            </colgroup>
            <tbody>
            {empty name="t"}
            <tr>
                <td>ID</td>
                <td>{$info.id}</td>
            </tr>
            <tr>
                <td>回复</td>
                <td> {$info['pid']?"回复（ID:".$info['pid']."）":''}</td>
            </tr>
            <tr>
                <td>评论文章</td>
                <td>{$info['article']['title']}</td>
            </tr>
            <tr>
                <td>会员</td>
                <td>{$info['user']['mobile']}</td>
            </tr>

            <tr>
                <td>留言时间</td>
                <td>{$info.create_time|date='Y-m-d H:i:s'}</td>
            </tr>
            <tr>
                <td>状态</td>
                <td>{$info['status']?'审核通过':'待审核'}</td>
            </tr>
            {/empty}
            <tr>
                {empty name="t"}
                <td>留言内容</td>
                {/empty}
                <td>{$info['content']}</td>
            </tr>
            </tbody>
        </table>

        {eq name="t" value="1"}
        <div class="layui-form-item">
            <button onclick="setStatus(1)" class="layui-btn" lay-filter="add" lay-submit="">
                审核通过
            </button>
            <button onclick="setStatus(-1)" class="layui-btn layui-btn-danger" lay-filter="add" lay-submit="">
                拒绝
            </button>
        </div>
        {/eq}

    </div>
</div>

<div id="idbox" style="display: none">

</div>
<script>
    layui.use(['form', 'layer'],
        function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;

        });

    function setStatus(status) {
        if(status==1){
            msg='您确定要【通过审核】吗？'
        }else{
            msg='您确定要【拒绝】吗？'
        }

        layer.confirm(msg,function(index){
            //发异步删除数据
            $.ajax({
                type: "POST",
                url: "{:url('msg_status')}",
                data: {id:'{$info["id"]}',status:status},
                dataType:'json',
                success: function (result) {
                    if(result.code){
                        layer.msg(result.msg,{icon:1,time:1000});
                        xadmin.close();
                        xadmin.father_reload();
                    }else{
                        layer.msg(result.msg,{icon:2,time:1000});
                    }
                },
                error: function(data) {
                    layer.msg(data.msg,{icon:2,time:1000});
                }

            });


        });
    }
</script>

</body>

</html>
